package com.example.film.service;

import com.example.film.entity.CinemaWeekSell;
import com.example.film.mapper.CinemaWeekSellMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class CinemaWeekSellServiceImpl implements CinemaWeekSellService{

    @Autowired
    private CinemaWeekSellMapper cinemaWeekSellMapper;

    @Override
    public List<CinemaWeekSell> findCinemaWeekSell() {
        return cinemaWeekSellMapper.findCinemaWeekSell();
    }

    @Override
    public List<CinemaWeekSell> findCinemaWeekSellInfo(Integer pageNum, Integer pageSize) {
        int startIndex = (pageNum - 1) * pageSize;
        return cinemaWeekSellMapper.findCinemaWeekSellInfo(startIndex,pageSize);
    }

    @Override
    public List<CinemaWeekSell> findCinemaWeekSellByWeek(Integer week, Integer pageNum, Integer pageSize) {
        int startIndex = (pageNum - 1) * pageSize;
        return cinemaWeekSellMapper.findCinemaWeekSellByWeek(week, startIndex, pageSize);
    }
}
